/* 
 * Copyright (C), 2016-2020, 厦门盈欣宝金融信息服务有限公司
 * Project Name :boot-parent
 * File Name: org.easytouseit.redis.service.impl
 * Encoding UTF-8 
 * Version: 1.0 
 * Date: 2018-09-12 15:41
 * History:  
 * 1. Date: 2018-09-12
 *    Author: guojm 
 *    Modification: 新建
 * 2. ...
 */
package org.easytouseit.redis.service.impl;

import org.easytouseit.redis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author guojm
 * @version V1.0
 * @date 2018-09-12 下午 15:41
 */
@Service
public class UserServiceImpl implements UserService{
    @Autowired
    StringRedisTemplate stringRedisTemplate;
    @Autowired
    RedisTemplate redisTemplate;

    @Cacheable(value = "user", key ="#id", unless = "#result==null")
    @Override
    public String getUser(int id) {
        System.out.println("i am from userService");
        System.out.println(stringRedisTemplate.getValueSerializer());
        System.out.println(redisTemplate.getValueSerializer());
        return "fee";
    }
}
